home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 011 / cshell23.arc / SHELL.DOC < prev    next >
Encoding:
Text File  |  1986-02-04  |  35.0 KB  |  924 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  69.  
  70.  
  71.  
  72.           NAME    
  73.           NAME  
  74.  
  75.  
  76.                pc-shell - pc command processor 
  77.  
  78.  
  79.           SYNOPSIS    
  80.           SYNOPSIS  
  81.  
  82.  
  83.                pc shell                              
  84.                pc-shell  [-s] [-v] [arg1 ... argn] 
  85.  
  86.  
  87.           DESCRIPTION    
  88.           DESCRIPTION  
  89.  
  90.  
  91.                pc-shell is a command processor for IBM-PC's and compatibles that 
  92.                emulates  some  of  the  more desirable functions of the Berkeley
  93.                UNIX* C-shell. In addition, it implements PC-DOS versions of some 
  94.                of the common UNIX* commands - ls, mv, cp, etc.  
  95.  
  96.  
  97.                     s                                                              
  98.                The -s option causes the program execute a file called "shell.rc" 
  99.                in the  current directory (if it exists) before  passing  control
  100.                to the user.  
  101.  
  102.  
  103.                      v                                                            
  104.                The  -v  option (verbose) causes the program to echo all commands
  105.                to the standard error stream before executing them.  
  106.  
  107.  
  108.                arg1     argn                                                      
  109.                arg1 ... argn (the command  line  arguments)  are  put  into  the
  110.                shell's environment as the variables $1 through $n.  
  111.  
  112.  
  113.  
  114.           Wild Card Substitution    
  115.           Wild Card Substitution  
  116.  
  117.  
  118.                Ambiguous  file  names  are expanded to file lists on the command
  119.                line for  all  internal  commands.    This  can  be  defeated  by
  120.                quoting.  
  121.  
  122.  
  123.                The file name expansion does not take place for external programs 
  124.                because  of  the  128  character  limit for the DOS command line.
  125.                Also, many programs do their own expansion,  to  circumvent  this
  126.                limit.  
  127.  
  128.  
  129.  
  130.           History Substitution    
  131.           History Substitution  
  132.  
  133.  
  134.  
  135.                History substitution is a powerful means to save retyping of long 
  136.                command lines.It allows you to do things like re-execute the last 
  137.                command,  re-execute  the  last  command but redirect output to a
  138.                file, or execute a  new  command  with  arguments  from  previous
  139.                command  lines.    The  last  20  commands  are saved, and can be
  140.                reviewed by typing the 'history' command.  
  141.  
  142.  
  143.                Previous commands can be referred to by their number, or relative 
  144.                to the  current  command's  number.    Parameters  from  previous
  145.                commands can be seperated out and used individually.  
  146.  
  147.  
  148.                History  substitutions  specifications  come  in  two parts - the
  149.                command number  specifier and the argument  specifier,  seperated
  150.                by a  colon.    The  argument    specifier  is optional; if it is
  151.                omitted, the entire command line is specified.  
  152.  
  153.  
  154.                <command specifier> ::= !! | !n | !-n 
  155.  
  156.  
  157.  
  158.                                               -1-
  159.  
  160.  
  161.  
  162.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  163.  
  164.  
  165.  
  166.                !!  = last command
  167.                !n  = nth command
  168.                !-n = command n commands before current command number
  169.                !#  = the current command line
  170.  
  171.  
  172.                <arg specifier> ::= :[^$*] | :n | :n* | <empty>
  173.                n   = number of argument (0 being the command name)
  174.                ^   = first argument (i.e. argv[1])
  175.                $   = last argument
  176.                *   = ^-$, or nothing if only one word on command line
  177.                n*  = arguments n through $
  178.  
  179.  
  180.                <history subst specification> ::= <command specifier><arg specifier>
  181.  
  182.  
  183.                This is not as complicatated as  it  may  appear.    Here  is  an
  184.                example session.  
  185.  
  186.  
  187.                EXAMPLE 
  188.  
  189.  
  190.                0% ls *.c
  191.                *.c
  192.                foo.c bar.c
  193.                1% more foo.c
  194.                /* edit the last argument of the last command */
  195.                2% edit !!:$            
  196.                /* go off and edit */
  197.                /* reference last argument of last command */
  198.                3% fgrep foo !!:$ bar.c 
  199.                FOO.C : foo
  200.                BAR.C : foo
  201.                /* edit the second thru the last args of command 3 */
  202.                4% edit !3:2*            
  203.                (go off and edit)
  204.                /* repeat last command */
  205.                %5 !!
  206.                (go off and edit)
  207.                /* remove the 1st argument of the command 2 before the current one */
  208.                %6 rm !-6:^
  209.  
  210.  
  211.                History substitution here is a compatible subset of the [U|XE]NIX 
  212.                C shell    history  substitution  facility.    Cshell allows even
  213.                weirder combinations.  
  214.  
  215.  
  216.  
  217.           Variable Substitution    
  218.           Variable Substitution  
  219.  
  220.  
  221.  
  222.                Shell variables are synonymous for our purposes with  environment
  223.                strings, i.e.  they are defined with the 'set' command.  
  224.  
  225.  
  226.                Variables  are  referenced  on  the  command  line by prefacing a
  227.                variable name by a dollar sign.    Two  dollar  signs  in  a  row
  228.                signify a dollar sign character.  
  229.  
  230.  
  231.                As  mentioned  above, command line arguments are contained in the
  232.                                                      n                             
  233.                shell variables, $1 through $n, where n is the number of the last 
  234.                argument.  
  235.  
  236.  
  237.  
  238.  
  239.                                               -2-
  240.  
  241.  
  242.  
  243.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  244.  
  245.  
  246.  
  247.                EXAMPLE
  248.  
  249.  
  250.                %0 set home = c:/
  251.                %1 echo $home
  252.                C:/
  253.                %2 ls $home
  254.                C:/*.*
  255.                command.com
  256.                %3 echo $path
  257.                C:/bin
  258.  
  259.  
  260.                And so on.  
  261.  
  262.  
  263.  
  264.           Special variables    
  265.           Special variables  
  266.  
  267.  
  268.                There are a some shell variables that have special  meanings  for
  269.                                                               set                 
  270.                the shell.   They can be given values with the set command.  They
  271.                are 
  272.  
  273.  
  274.               NOCLOBBER    
  275.               NOCLOBBER  
  276.  
  277.  
  278.                       NOCLOBBER                                                   
  279.                    If NOCLOBBER is equal to '1', then existing files may not  be
  280.                    destroyed  by  output  redirection,  and  output  files to be
  281.                    appended to by >> must exist.  
  282.  
  283.  
  284.  
  285.               PROMPT    
  286.               PROMPT  
  287.  
  288.  
  289.                        PROMPT                                                     
  290.                    The PROMPT environment string is handled the same way  as  it
  291.                           COMMAND COM                                             
  292.                    is by  COMMAND.COM.    There  is one pc-shell-specific prompt
  293.                    string character  !    that  specifies  the  current  command
  294.                    index.   If no PROMPT environment string is defined, then the
  295.                    default is '$!% '.  
  296.  
  297.  
  298.  
  299.           Multiple commands on one command line    
  300.           Multiple commands on one command line  
  301.  
  302.  
  303.                Command lines are split at semicolons.  This can be  defeated  by
  304.                quoting or escaping.  
  305.  
  306.  
  307.                EXAMPLE 
  308.  
  309.  
  310.                %0 ls -l *.c ; make shell.exe ; exit
  311.  
  312.  
  313.           Conditional command execution    
  314.           Conditional command execution  
  315.  
  316.  
  317.                If  two  commands  are seperated by '&&', then the second will be
  318.                executed only if the first returns 0 as an exit  code.    If  two
  319.                commands  are seperated by '||', then the second will be executed
  320.                only the first command returns non-zero as an exit code.  
  321.  
  322.  
  323.                Example 
  324.  
  325.  
  326.                    make shell.exe && chmod +w /bin/shell.exe && mv shell.exe /bin 
  327.  
  328.  
  329.                    If the make operation fails, then the chmod and the  mv  will
  330.                    not be executed.  
  331.  
  332.  
  333.  
  334.                                               -3-
  335.  
  336.  
  337.  
  338.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  339.  
  340.  
  341.  
  342.                    make shell.exe || echo You blew it bub!
  343.  
  344.  
  345.                    If  the make operation fails, then the echo operation will be
  346.                    executed.  
  347.  
  348.  
  349.  
  350.           Character Escapes  Shell Comments  and Argument Quoting    
  351.           Character Escapes, Shell Comments, and Argument Quoting  
  352.  
  353.  
  354.                Any character preceded by a  \ (backslash) is  copied  unmodified
  355.                to the  command  buffer.  This allows you to suppress the special
  356.                meanings of shell command characters, such as '|',  ';',  and  '*
  357.                '.  
  358.  
  359.  
  360.                # is  the  shell comment character.  Anything on a line after a #
  361.                character is ignored.  
  362.  
  363.  
  364.                String surrounded by single or double quotes are stripped of  the
  365.                quotes,  and  passed  without  wild-card expansion to the invoked
  366.                program.  
  367.  
  368.  
  369.  
  370.           Startup and Script Files    
  371.           Startup and Script Files  
  372.  
  373.  
  374.  
  375.                If '-s' is specified on the command line the  program  will  look
  376.                for  a file called SHELL.RC in the current directory, and execute
  377.                it before passing  control to the console.  This  allows  you  to
  378.                set up  all  your alias commands.  It isn't a good idea to put an
  379.                'exit'  command  in  your  SHELL.RC  file,  as  the  shell   will
  380.                terminate.  
  381.  
  382.  
  383.                                              sh                                   
  384.                Any file  whose extension is .sh is run as a command file.  There
  385.                                  sh                                                
  386.                is also a command sh, into which shell scripts whose extension is 
  387.                not .sh can be redirected as standard input.  
  388.  
  389.  
  390.                EXAMPLE
  391.  
  392.  
  393.                %0 sh <batch.fil        # use the sh command
  394.                %1 shell <batch.fil     # run the external program
  395.  
  396.  
  397.  
  398.           INPUT OUTPUT    
  399.           INPUT/OUTPUT  
  400.  
  401.  
  402.                                                          COMMAND COM              
  403.                I/O redirection operates as it does under COMMAND.COM  with  some
  404.                additional options: 
  405.  
  406.  
  407.             name   
  408.            <name 
  409.  
  410.  
  411.                               name                           
  412.                Opens the file name as the standard input.  
  413.  
  414.  
  415.              word   
  416.            <<word 
  417.  
  418.  
  419.                                                                            word   
  420.                reads  the  shell  input up to a line which is identical to word.
  421.                The resulting text is put into an anonymous temporary file, which 
  422.                is given to the command as standard input.  
  423.  
  424.  
  425.                 name  
  426.                >name
  427.                  name  
  428.                >!name
  429.  
  430.  
  431.  
  432.                                               -4-
  433.  
  434.  
  435.  
  436.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  437.  
  438.  
  439.  
  440.                  name  
  441.                >&name
  442.                   name  
  443.                >&!name
  444.  
  445.  
  446.                             name                                                  
  447.                    The file name  is used as standard output.    If  it  doesn't
  448.                    exist,  it's  created; if it exists, it is truncated, and its
  449.                    previous contents are lost.  
  450.  
  451.  
  452.                                    NOCLOBBER                                      
  453.                    If the variable NOCLOBBER is set, the file must  not  already
  454.                    exist, or  an  error results.  The forms using an exclamation
  455.                    point override the NOCLOBBER variable's action.  
  456.  
  457.  
  458.                               name                                                
  459.                    The form >&name routes standard  error  along  with  standard
  460.                              name     
  461.                    output to name.  
  462.  
  463.  
  464.                  name  
  465.                >>name
  466.                   name  
  467.                >>!name
  468.                   name  
  469.                >>&name
  470.                    name  
  471.                >>&!name
  472.  
  473.  
  474.                                     name                                          
  475.                    Uses  the  file  name  as standard output, like >, but places
  476.                                                                NOCLOBBER           
  477.                    output at the end of file.  If the variable NOCLOBBER is set, 
  478.                    it is an error if the file doesn't already exist.  The  forms
  479.                    using  an exclamation point override the NOCLOBBER variable's
  480.                    action.  
  481.  
  482.  
  483.  
  484.               BUILT IN COMMANDS    
  485.               BUILT-IN COMMANDS  
  486.  
  487.  
  488.  
  489.                    Some of the internal commands are  UNIX*  style  replacements
  490.                    for  COMMAND.COM internal commands, and some are included for
  491.                    convenience.  
  492.  
  493.  
  494.                        Output of the 'commands' command
  495.  
  496.  
  497.                        a:              alias           b:              c:              
  498.                        cat             cd              chdir           chmod           
  499.                        cls             commands        copy            cp              
  500.                        d:              del             dir             dump            
  501.                        e:              echo            era             erase           
  502.                        error           exit            f:              fgrep           
  503.                        g:              h:              hd              history         
  504.                        i:              j:              ls              md              
  505.                        mkdir           more            mv              no history      
  506.                        popd            pushd           pwd             rd              
  507.                        rm              rmdir           set             sh              
  508.                        tee             touch           unalias         version         
  509.                        y               
  510.  
  511.  
  512.                    There are many that are simply aliases, e.g.  'copy' and 'cp' 
  513.                    invoke the same program.  
  514.  
  515.  
  516.  
  517.               COMMAND DESCRIPTION SYNTAX    
  518.               COMMAND DESCRIPTION SYNTAX  
  519.  
  520.  
  521.                    terms used in syntax explanations :
  522.                    
  523.                    fname ::= PC-DOS ambiguous or unambiguous file or directory name.
  524.  
  525.  
  526.  
  527.                                               -5-
  528.  
  529.  
  530.  
  531.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  532.  
  533.  
  534.  
  535.                    
  536.                    uname ::= unambiguous PC-DOS file or directory name
  537.                    
  538.                    string ::= any string of printable characters of arbitrary(<512) length.
  539.                    
  540.                    filelist ::= filename [filename .. filename]
  541.                    
  542.                    noargs ::= no arguments at all
  543.                    
  544.                    space ::= any white space characters
  545.                    
  546.                    {arg} ::= term is optional
  547.                    
  548.                    envstring ::=    <string>=<string> | <string><space>=<space><string> |
  549.                 <string><space><string>
  550.  
  551.  
  552.  
  553.               COMMANDS    
  554.               COMMANDS  
  555.  
  556.  
  557.  
  558.                    drive  
  559.                    drive
  560.  
  561.  
  562.                        a: | b: | c: | d: | e: | f: | g: | h: | i: | j: <noargs> 
  563.  
  564.  
  565.                        changes default drive.  If you don't have such  a  drive,
  566.                        nothing happens.  
  567.  
  568.  
  569.                    alias  
  570.                    alias
  571.  
  572.  
  573.                        alias <envstring> 
  574.  
  575.  
  576.                        assigns cmdstring  to name.  name can now be used just as
  577.                        if it were a built-in or external command.  cmdstring may 
  578.                        contain history expressions or variable substitutions.  
  579.  
  580.  
  581.                        The syntax of this command is flexible - you can  specify
  582.                        alii  (?)  in  the form 'name=subst','name subst','name =
  583.                        subst', or  'name  =subst.'  However  you  need  a  space
  584.                                   before                                          
  585.                        character  before  a  single quote in order to specify an
  586.                        alias that contains blanks.  
  587.  
  588.  
  589.                            alias     set                                          
  590.                        The alias and set commands  are  case  sensitive,  unlike
  591.                                         COMMAND COM     
  592.                        their analogs in COMMAND.COM.  
  593.  
  594.  
  595.                    cat  
  596.                    cat
  597.  
  598.  
  599.                        cat {<filelist>} 
  600.  
  601.  
  602.                        copies specified  files  to standard output.  If none are
  603.                        given, copies standard input to standard output 
  604.  
  605.  
  606.                    cp  
  607.                    cp
  608.  
  609.  
  610.                        cp | copy <filelist> <uname> 
  611.  
  612.  
  613.                        copies specified files to destination file or device.  If 
  614.                        more than one file is in the file list, <uname> must be a 
  615.                        directory.  
  616.  
  617.  
  618.  
  619.                                               -6-
  620.  
  621.  
  622.  
  623.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  624.  
  625.  
  626.  
  627.                    cd  
  628.                    cd
  629.  
  630.  
  631.                        cd | chdir <dirname> 
  632.  
  633.  
  634.                        makes <dirname> the current default directory.  
  635.  
  636.  
  637.                    chmod  
  638.                    chmod
  639.  
  640.  
  641.                        chmod {-|+[rwh]*} <filelist> 
  642.  
  643.  
  644.                        change file permissions for specified files 
  645.  
  646.  
  647.                        +r, -r turn on or off read permission - i.e. hide the file.
  648.                        +w, -w turn on or off write permission.
  649.                        +h, -h turn on or off hidden attribute - converse of r
  650.                        +a, -a turn on or off archive attribute
  651.  
  652.  
  653.                        Note that '-r'  or  '+rwh'  are  both  valid  syntax  for
  654.                        switches.   Also  new permission switches are permissable
  655.                        between file names with the following  warning:  I  don't
  656.                        reset the masks between file names - if you have a second 
  657.                        batch  of  attribute  changes  on  the  command line, the
  658.                        effect is additive.  If you're  not  careful,  you  could
  659.                        make a mess of a files attributes.  
  660.  
  661.  
  662.                        If   you  don't  specify  any  attribute  switches,  file
  663.                        attributes will be set to 0, which  means  read,write,not
  664.                        hidden,not system, not  modified since last backup.  
  665.  
  666.  
  667.                    cls  
  668.                    cls
  669.  
  670.  
  671.                        cls <noargs> 
  672.  
  673.  
  674.                        clears the screen and homes the cursor.  
  675.  
  676.  
  677.                    commands  
  678.                    commands
  679.  
  680.  
  681.                        commands <noargs> 
  682.  
  683.  
  684.                        prints a  table  of  available  built-in  commands.  (see
  685.                        above) 
  686.  
  687.  
  688.                    del  
  689.                    del
  690.  
  691.  
  692.                        del 
  693.  
  694.  
  695.                        synonym for rm.  
  696.  
  697.  
  698.                    dir  
  699.                    dir
  700.  
  701.  
  702.                        dir 
  703.  
  704.  
  705.                        synonym for ls.  
  706.  
  707.  
  708.                    dump  
  709.                    dump
  710.  
  711.  
  712.  
  713.                        dump filespec [block [page]] | [segment:[offset]] [count] 
  714.  
  715.  
  716.  
  717.                                               -7-
  718.  
  719.  
  720.  
  721.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  722.  
  723.  
  724.  
  725.                        Where a block is 64K bytes and a page is 256 bytes
  726.                        Segment:offset are standard 8086 notation in hexadecimal
  727.                        Count is the number of bytes to dump in decimal
  728.  
  729.  
  730.                        This came from some anonymous public domain source, ported by me
  731.  
  732.  
  733.                    echo  
  734.                    echo
  735.  
  736.  
  737.                        echo <anything> 
  738.  
  739.  
  740.                        echos argument list to screen.  
  741.  
  742.  
  743.                    era  
  744.                    era
  745.  
  746.  
  747.                        era 
  748.  
  749.  
  750.                        synonym for rm.  
  751.  
  752.  
  753.                    error  
  754.                    error
  755.  
  756.  
  757.                        error <noargs> 
  758.  
  759.  
  760.                        prints returned value of last command to the screen.  
  761.  
  762.  
  763.                    exit  
  764.                    exit
  765.  
  766.  
  767.                        exit <noargs> 
  768.  
  769.  
  770.                        terminates execution of the shell.  
  771.  
  772.  
  773.                    fgrep  
  774.                    fgrep
  775.  
  776.  
  777.                        fgrep <pattern> <filelist> 
  778.  
  779.  
  780.                        looks for unambiguous pattern  <pattern>  in  <filelist>.
  781.                        echos lines matching to the screen.  
  782.  
  783.  
  784.                    history  
  785.                    history
  786.  
  787.  
  788.                        history <noargs> 
  789.  
  790.  
  791.                        prints history list to standard output.  
  792.  
  793.  
  794.                    ls  
  795.                    ls
  796.  
  797.  
  798.                        ls | dir {-[alqctrR]} <filelist> 
  799.  
  800.  
  801.                        Lists files that match <filelist> 
  802.  
  803.  
  804.                        -a all files, including system files are listed.  '.' and 
  805.                        '..'  are  suppressed,  but you know they're there if you
  806.                        need them, don't you?  
  807.                        -l prints out file times, permissions, etc 
  808.                        -q suppresses header line from display - useful when  you
  809.                        want to pipe stuff into another program.  
  810.                        -c print as one column.  
  811.                        -t sort by time, most recent last 
  812.                        -R recurse through all encountered subdirectories.  
  813.  
  814.  
  815.  
  816.                                               -8-
  817.  
  818.  
  819.  
  820.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  821.  
  822.  
  823.  
  824.                        -r reverses sort order.  
  825.  
  826.  
  827.                    md  
  828.                    md
  829.  
  830.  
  831.                        md | mkdir <uname> 
  832.  
  833.  
  834.                        make a directory.  Prints an error if it can't be done 
  835.  
  836.  
  837.                    more  
  838.                    more
  839.  
  840.  
  841.                        more {-[0-9]*} {<filelist>} 
  842.  
  843.  
  844.                        List file to screen with pauses 
  845.  
  846.  
  847.                        -n  specify  tab width when expanding tabs, where n is an
  848.                        integer.  more acts like 'cat' when redirected - you  can
  849.                        concatenate files  in  this  manner.    If  no  files are
  850.                        specifed, standard input is 'mored.' 
  851.  
  852.  
  853.                    mv  
  854.                    mv
  855.  
  856.  
  857.                        mv <filelist> <uname> 
  858.  
  859.  
  860.                        moves specified file  or  files  to  target  specifed  by
  861.                        <uname>.  If there is more than one file in list, <uname> 
  862.                        must be a directory 
  863.  
  864.  
  865.                    popd  
  866.                    popd
  867.  
  868.  
  869.                        popd <noargs> 
  870.  
  871.  
  872.                        returns to directory at top of directory stack.  
  873.  
  874.  
  875.                    pushd  
  876.                    pushd
  877.  
  878.  
  879.                        pushd <uname> 
  880.  
  881.  
  882.                        save  current  working  directory on directory stack, and
  883.                        changes current working directory to <uname>.  
  884.  
  885.  
  886.                    pwd  
  887.                    pwd
  888.  
  889.  
  890.                        pwd 
  891.  
  892.  
  893.                        prints current working directory to standard output.  
  894.  
  895.  
  896.                    rd  
  897.                    rd
  898.  
  899.  
  900.                        rd | rmdir <uname> 
  901.  
  902.  
  903.                        remove specified directory if possible.  
  904.  
  905.  
  906.                    rm  
  907.                    rm
  908.  
  909.  
  910.                        rm {-q} <filelist> 
  911.  
  912.  
  913.                        blows away all files in <filelist>. If -q  is  specified,
  914.                        will ask if they should be removed.  
  915.  
  916.  
  917.  
  918.                                               -9-
  919.  
  920.  
  921.  
  922.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  923.  
  924.  
  925.  
  926.                    set  
  927.                    set
  928.  
  929.  
  930.                        set {<envstring>} 
  931.  
  932.  
  933.                        sets a string in the environment.  If you specify 'name=' 
  934.                        with  no  string  after,  it  will  remove  it  from  the
  935.                        environment.  If you don't specify a string,  set  prints
  936.                        out current environment.  
  937.  
  938.  
  939.                        The  syntax of this command is flexible - you can specify
  940.                        set in the form 'set  name=subst','set  name  subst','set
  941.                        name  =  subst', or 'set name =subst.' However you need a
  942.                                        before                                      
  943.                        space character before a single quote in order to specify 
  944.                        a substitution string that contains blanks.  
  945.  
  946.  
  947.                    sh  
  948.                    sh
  949.  
  950.  
  951.                        sh { <arg1> .. <argn>} <scriptfile 
  952.  
  953.  
  954.                        forks a  'local'  shell  -  i.e.    saves  all  pertinent
  955.                        information  about  the  shell  you're  currently  in and
  956.                        invokes the command processor function recursively,  with
  957.                        scriptfile                                                 
  958.                        scriptfile as  input.    The  arguments  are copied to $1
  959.                        through $N environment strings, overwriting  the  startup
  960.                        arguments.  
  961.  
  962.  
  963.                        sh                                                         
  964.                        sh  gives  you  a  way to run scripts, without loading an
  965.                        extra copy of shell.com or small.com.  
  966.  
  967.  
  968.                    tee  
  969.                    tee
  970.  
  971.  
  972.                        tee <uname> 
  973.  
  974.  
  975.                        Copies standard input to standard  output,  depositing  a
  976.                        copy in <uname> 
  977.  
  978.  
  979.                    touch  
  980.                    touch
  981.  
  982.  
  983.                        touch <filelist> 
  984.  
  985.  
  986.                        Makes  the  modification  time  of  specified  files  the
  987.                        current date and time.  
  988.  
  989.  
  990.                    unalias  
  991.                    unalias
  992.  
  993.  
  994.                        unalias aliasname 
  995.  
  996.  
  997.                        remove alias name from the alias list.  
  998.  
  999.  
  1000.                    y  
  1001.                    y
  1002.  
  1003.  
  1004.                        y <filelist> 
  1005.  
  1006.  
  1007.                        copies standard input to standard output, and then copies 
  1008.                        the specified files to standard  output.    Sort  of  the
  1009.                        opposite of tee, in other words.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.                                              -10-
  1016.  
  1017.  
  1018.  
  1019.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  1020.  
  1021.  
  1022.  
  1023.               The Small Shell    
  1024.               The Small Shell  
  1025.  
  1026.  
  1027.  
  1028.                    Included  in release 2.0 or later is a 'small' version of the
  1029.                    shell.   This version will take up less than 30K of memory at 
  1030.                     runtime (as verified by chkdsk).  What's the catch?    Well,
  1031.                    ls,  cp,  mv, more, fgrep, and dump become external commands.
  1032.                    I am not going to distribute these commands; you  can  either
  1033.                    make  them    yourself,  or  you can use whatever you have on
  1034.                    hand.  If you need to use the COMMAND.COM copy facility,  try
  1035.                    putting these commands in your SHELL.RC file 
  1036.  
  1037.  
  1038.                    alias cp 'command -c copy'
  1039.                    alias ls 'command -c dir -w | sort'
  1040.  
  1041.  
  1042.                    The   removed   commands   accounted  for  over  10K  of  the
  1043.                    shell.com.  
  1044.  
  1045.  
  1046.               Helpful hints    
  1047.               Helpful hints  
  1048.  
  1049.  
  1050.  
  1051.                    Use forward slashes in all path names.  (See  note  below  on
  1052.                    switch  characters)    If  you  use  DOS  3.0 or higher, this
  1053.                    includes paths to transient programs.  
  1054.  
  1055.  
  1056.                    put single quotes around arguments with semicolons  in  them,
  1057.                    so they don't turn into command delimiters.  
  1058.  
  1059.  
  1060.                    The  set  command affects only the local shell's environment.
  1061.                    You can 'exit' to command.com and the original environment is 
  1062.                    intact.  The  local  environment  is  2K  large  -  which  is
  1063.                    useful.  
  1064.  
  1065.  
  1066.                    When  using  the  Microsoft  C  compiler  under pc-shell, the
  1067.                    compiler has a bad habit of  look  for  parameters  beginning
  1068.                    with forward  slashes  in  the environment.  If you get their
  1069.                    famous  'P0  :  bad  option'  message,   try   revising   the
  1070.                    environment.  
  1071.  
  1072.  
  1073.  
  1074.               Implementation notes    
  1075.               Implementation notes  
  1076.  
  1077.  
  1078.  
  1079.                    DOS  doesn't  acknowledge  a  'change  default drive' command
  1080.                    until you issue a 'get current directory' call.   Why?    The
  1081.                    only way I figured this out is by disassembling command.com.  
  1082.  
  1083.  
  1084.                    PC|MS-DOS has  a  limit  of  20  file  handles.  If you add a
  1085.                    command that opens files, make sure you catch the  ctrl-break
  1086.                    signal and close them.  Look at CAT.C or Y.C for examples.  
  1087.  
  1088.  
  1089.                    DON'T  REDIRECT  INPUT  INTO  PRINT. Print gets all hosed up.
  1090.                    Print has lots of trouble in general with the  pc-shell,  and
  1091.                    should be avoided.  
  1092.  
  1093.  
  1094.               BUGS    
  1095.               BUGS  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.                                              -11-
  1102.  
  1103.  
  1104.  
  1105.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  1106.  
  1107.  
  1108.  
  1109.                    Due  to  the way that environment strings are expanded on the
  1110.                    command line, semicolons inside  shell  variables  look  like
  1111.                    command seperators.  This is not so much a bug as a gotcha.  
  1112.  
  1113.  
  1114.                    I  have  noticed intermittent problems running on an AT, with
  1115.                    DOS 3.0, but have been unable to reproduce them on  a  PC.  I
  1116.                    suspect bugs in DOS 3.0 that are absent in 3.1. If you notice 
  1117.                    any consistent problems, send  me a bug report.  
  1118.  
  1119.  
  1120.                    DON'T  REDIRECT INPUT INTO PRINT. It gets mighty confused and
  1121.                    goes into  an  endless  loop.      Don't   blame   me,   call
  1122.                    MICROSOFT/IBM,  and  ask  them  where  the heck they look for
  1123.                    their command line!!!  
  1124.  
  1125.  
  1126.               HISTORY    
  1127.               HISTORY  
  1128.  
  1129.  
  1130.  
  1131.  
  1132.                   V 2 0    
  1133.                   V 2.0  
  1134.  
  1135.  
  1136.                        Minor bug fixes.  Started allocating command buffers  out
  1137.                        of heap rather than stack, reducing stack usage.  Stopped 
  1138.                        releasing source with executables.  
  1139.  
  1140.  
  1141.                   V 2 1    
  1142.                   V 2.1  
  1143.  
  1144.  
  1145.                        Fixed the bug that made "mv foo .." throw away the source 
  1146.                        file and  move  it to "..foo", (i.e. nowhere).  Added the
  1147.                        sh command,  that  allows  you  to  run  scripts  without
  1148.                        re-invoking the shell.  
  1149.  
  1150.  
  1151.                   V 2 2    
  1152.                   V 2.2  
  1153.  
  1154.  
  1155.                        Fixed  the bug that locked pc up when a command line with
  1156.                        a leading ; was entered.  Changed fork code so that files 
  1157.                        with the extension .sh are run as scripts.    The  equals
  1158.                        sign in alias and set is now optional.  
  1159.  
  1160.  
  1161.                   V 2 3    
  1162.                   V 2.3  
  1163.  
  1164.  
  1165.                        Removed  information  about versions 1.0 through 1.6 from
  1166.                        documentation, adding any relevant material to  the  tips
  1167.                        or implementation  notes sections.   Added redirection of
  1168.                        standard error, and checking for  NOCLOBBER.  Implemented
  1169.                        execution of the prompt string.  
  1170.  
  1171.  
  1172.                        The  switch  character  is now changed back to '/' before
  1173.                        executing external  commands.    This  should  make  some
  1174.                        Microsoft programs  happier.    The  environment with its
  1175.                        forward slashes in the path are left intact.   We'll  see
  1176.                        how that goes.  
  1177.  
  1178.  
  1179.                   DONATIONS REQUESTED    
  1180.                   DONATIONS REQUESTED  
  1181.  
  1182.  
  1183.  
  1184.                        The shell seems to have generated an incredible amount of 
  1185.                        interest, all around the country - someone apparently put 
  1186.                        this code out over the usenet and arpanet, in addition to 
  1187.  
  1188.  
  1189.  
  1190.                                              -12-
  1191.  
  1192.  
  1193.  
  1194.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  1195.  
  1196.  
  1197.  
  1198.                        its original FIDOnet roots.  
  1199.  
  1200.  
  1201.                        I  would  like  to  keep  working  on  it,  but for it to
  1202.                        progress further, it can  no  longer  be  a  'lunch  hour
  1203.                        hack.' I am therefore requesting that those who feel that 
  1204.                        this  is a useful piece of software send me a donation to
  1205.                        further my efforts towards purchasing a machine for  home
  1206.                        use.  
  1207.  
  1208.  
  1209.                        Anyone  sending  more  that 25$ will recieve: 1. a PC-DOS
  1210.                        disk with most recent release full source and  executable
  1211.                        image.  2. Source and executable for various other public 
  1212.                        domain  *nix  programs  (tail,  nroff,  cut, paste, diff,
  1213.                        grep) 
  1214.  
  1215.  
  1216.                        If you use this every day, or if you are giving  everyone
  1217.                        in   your   place   of   employment   a  copy,  value  it
  1218.                        accordingly.  
  1219.  
  1220.  
  1221.                        This does not constitute a  licensing  agreement  of  any
  1222.                        sort, nor  is any warranty implied.  Once you have a copy
  1223.                        of this program or its source,  it's  yours  to  hack  to
  1224.                        pieces, use,  revere,  revile,  or  whatever.  I like the
  1225.                        anarchic aspects of the various public domain networks.  
  1226.  
  1227.  
  1228.                        QUESTIONS COMMENTS BUGREPORTS GOTO 
  1229.                        KENT WILLIAMS
  1230.                        722 Rundell St.
  1231.                        Iowa City, IA 52240
  1232.                        (319) 338-6053 (HOME VOICE)
  1233.                        
  1234.                        * UNIX is an unregistered trademark of AT&T.
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263.  
  1264.                                              -13-
  1265.  
  1266.  
  1267.